[Unit]
Description=Kubernetes worker
After=docker.service cgconfig.service
Requires=docker.service cgconfig.service

[Service]
TimeoutStartSec=0
Restart=always
LimitNOFILE=65536
ExecStart=/opt/nauta/kubernetes/kubelet \
                  --address {{ nauta_configuration.internal_interface.ipv4_address }} \
                  --hostname-override "{{ inventory_hostname }}.node.{{ nodes_domain }}.{{ domain }}" \
                  --network-plugin cni --cloud-provider "" --node-ip {{ nauta_configuration.internal_interface.ipv4_address }} \
                  --cluster-dns {{ kubernetes_network.svc_list.dns.ip }} --cluster-domain {{ k8s_domain }}.{{ domain }} \
                  --node-labels {{ labels }} --pod-manifest-path=/etc/kubelet/static \
                  --allow-privileged=True --kubeconfig /etc/kubelet/kubelet \
                  {{ feature_gates }} \
                  --cert-dir /etc/kubelet/ssl --system-reserved cpu={{ host_reserved.cpus }},memory={{ host_reserved.memory }}M \
                  --fail-swap-on=false \
                  --cni-bin-dir /opt/nauta/cni-plugins \
                  --pod-infra-container-image registry.service.{{ nodes_domain }}.{{ domain }}:5000/core/pause:3.1 \
                  --serialize-image-pulls=True --image-pull-progress-deadline=30m0s \
                  --client-ca-file /etc/nauta-cluster/client/kubernetes/ca.pem \
                  --tls-cert-file /etc/nauta-cluster/client/kubernetes/node.crt \
                  --tls-private-key-file /etc/nauta-cluster/client/kubernetes/node.key --maximum-dead-containers 512 \
                  --maximum-dead-containers-per-container 1 --minimum-container-ttl-duration 0 \
                  --cpu-manager-policy={{ cpu_manager_policy }} \
                  --system-reserved={{ system_reserved }} \
                  --kube-reserved={{ kube_reserved }} \
                  --cgroups-per-qos={{ cgroups_per_qos }} \
                  --max-pods={{ max_pods }}
RestartSec=10
StartLimitInterval=0


[Install]
WantedBy=multi-user.target
